package org.valire.usermanagement;

import java.util.List;
import java.util.Set;

public interface NodeAccessPermissionManagementFacade {
	

	/**
	 * The Interface NAPValidationInterface.
	 */
	public interface NAPValidationInterface {

		/**
		 * Check.
		 * 
		 * @param nodeRef
		 *            the node ref
		 * @param path
		 *            the path
		 * @return true, if successful
		 */
		boolean check(Integer nodeRef, String path);
	}
	
	/**
	 * Creates the acm.
	 * 
	 * @param nap
	 *            the nap
	 * @return the role
	 */
	public NapDto createNAP(NapDto nap);

	/**
	 * Removes the acm.
	 * 
	 * @param nap
	 *            the nap
	 */
	public void removeNAP(NapDto nap);

	
	/**
	 * Gets the all roles.
	 * 
	 * @return the all roles
	 */
	public List<NapDto> getAllNAPs();

	/**
	 * Gets the method roles.
	 * 
	 * @param allRoles
	 *            the all roles
	 * @return the method roles
	 */
	Set<NapDto> getNAPsForRoles(Set<RoleDto> allRoles);

	/**
	 * Gets the nA ps for users.
	 * 
	 * @param allUsers
	 *            the all users
	 * @return the nA ps for users
	 */
	Set<NapDto> getNAPsForUsers(Set<UserDto> allUsers);

	/**
	 * Check method access for role.
	 *
	 * @param role the role
	 * @param method the method
	 * @param validationInterface the validation interface
	 * @return true, if successful
	 */
	boolean hasPermissionForRole(RoleDto role, String method, NodeAccessPermissionManagementFacade.NAPValidationInterface validationInterface);

	/**
	 * Checks for permission.
	 *
	 * @param role the role
	 * @param method the method
	 * @param validationInterface the validation interface
	 * @return true, if successful
	 */
	boolean hasPermissionForRoles(Set<RoleDto> role, String method, NodeAccessPermissionManagementFacade.NAPValidationInterface validationInterface);

	/**
	 * Checks for permission.
	 *
	 * @param user the user
	 * @param method the method
	 * @param validationInterface the validation interface
	 * @return true, if successful
	 */
	boolean hasPermissionForUser(UserDto user, String method, NodeAccessPermissionManagementFacade.NAPValidationInterface validationInterface);

	/**
	 * Checks for permission.
	 *
	 * @param users the users
	 * @param method the method
	 * @param validationInterface the validation interface
	 * @return true, if successful
	 */
	boolean hasPermissionForUsers(Set<UserDto> users, String method, NodeAccessPermissionManagementFacade.NAPValidationInterface validationInterface);

	/**
	 * Update mac.
	 * 
	 * @param nap
	 *            the nap
	 */
	void updateNAPs(NapDto nap);

	/**
	 * Removes the all na ps for users.
	 *
	 * @param users the users
	 */
	void removeAllNAPsForUsers(Set<UserDto> users);

	/**
	 * Removes the all na ps for roles.
	 *
	 * @param roles the roles
	 */
	void removeAllNAPsForRoles(Set<RoleDto> roles);
}
